package main

import "fmt"

type Human struct {
	name string
	sex  string
}

func (this *Human) Eat() {
	fmt.Println("Human.Eat.....")
}

func (this *Human) Walk() {
	fmt.Println("Human.Walk....")
}

type SuperMan struct {
	Human //表示该类继承了Human类的方法

	level int
}

func (this *SuperMan) Eat() {
	fmt.Println("SuperMan.Eat()....")
}
func (this *SuperMan) Fly() {

	fmt.Println("SuperMan.Fly...")
}

func main() {
	h := Human{"niuzi", "男"}
	h.Eat()
	h.Walk()

	s := SuperMan{Human{"chaoren", "男"}, 1}
	s.Walk() //父类的方法
	s.Fly()
	s.Eat()

	s.sex = "男"
	s.name = "ding"
	s.level = 20

	fmt.Println(s)

}
